﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Restaurant.DTO;
using Restaurant.DAO;
using System.Data;



namespace Restaurant.BUS
{
    public class NguyenLieuService
    {
        private NguyenLieuDB httDAO = new NguyenLieuDB();

        public DataTable LayNguyenLieu()
        {
            return httDAO.LayNguyenLieu();
        }

        public DataTable LayNguyenLieuTheoMa(int ma)
        {
            //DataTable dbtab = httDAO.LayNguyenLieuTheoMa(ma);
            //DataRow dbrow = dbtab.Rows[0];
            //return dbrow[1].ToString();
            return httDAO.LayNguyenLieuTheoMa(ma);
        }

        public DataTable LayNguyenLieuTheoLoai(int ma)
        {
            return httDAO.LayNguyenLieuTheoLoai(ma);
        }

        public DataTable LayNguyenLieuTheoDVT(int ma)
        {
            return httDAO.LayNguyenLieuTheoDVT(ma);
        }

        public DataTable LayNguyenLieuTheoNCC(int ma)
        {
            return httDAO.LayNguyenLieuTheoNCC(ma);
        }

        public bool ThemNguyenLieu(string TenNL, int MaNCC, int MaDVT, int MaLoaiNL)
        {
            if (TenNL == "")
            {
                return false;
            }
            if (httDAO.ThemNguyenLieu(TenNL,MaNCC,MaDVT,MaLoaiNL))
                return true;
            return false;
        }

        public bool XoaNguyenLieu(int maNL)
        {
            if (httDAO.XoaNguyenLieu(maNL))
                return true;
            return false;
        }

        public bool SuaNguyenLieu(int MaNL, string TenNL, int MaNCC, int MaDVT, int MaLoaiNL)
        {
            if (httDAO.SuaNguyenLieu(MaNL,TenNL,MaNCC,MaDVT,MaLoaiNL))
                return true;
            return false;
        }
    }
}
